Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored the code. Works with mocks now. #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

iaforek
Copy link

@iaforek iaforek commented Oct 4, 2017

Changed object properties to methods in order to get this to work with aws-sdk-mock. When running sls invoke test isOffline() will return false. Therefore, you must set IS_OFFFLINE=true as environment variable manually prior running test locally or you can add to your tests:

before((done) => {
    process.env.IS_OFFLINE = true;
    ...
    done();
});

and

after((done) => {
    delete process.env.IS_OFFLINE;
    ...
    done();
});

In the code use: docClient = dynamodb.doc() instead of const docClient = dynamodb.doc.
This will work with AWS, serverless offline and mocks.

Additionally, made ESLint changes.

Changed object properties to methods in order to get this to work with mocks. When running `sls invoke test` isOffline() will return false. Therefore, you must set IS_OFFFLINE=true as environment variable manually prior running test locally or you can add to your tests:

    before((done) => {
        process.env.IS_OFFLINE = true;
        ...
        done();
    });

and

    after((done) => {
        delete process.env.IS_OFFLINE;
        ...
        done();
    });

In the code use: `docClient = dynamodb.doc()` instead of `const docClient = dynamodb.doc`.
This will work with AWS, serverless offline and mocks.

Additionally, made ESLint changes.
@mystix mystix mentioned this pull request Jul 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant